package com.xr.enums;

/**
 * @author Arnold Yand
 * @summary 访问渠道
 * @time 2018/3/24 17:56
 */
public enum AccessChannel {

  UNKNOWN(0, "未知"),
  WEB(1, "PC官网"),
  WAP(2, "微站"),
  ANDROID(3, "ANDROID"),
  IOS(4, "IOS"),
  WECHAT(5, "微信"),
  ;

  private int code;
  private String label;
  private AccessChannel(int code, String label){
    this.code = code;
    this.label = label;
  }

  public static AccessChannel parse(int code){
    for(AccessChannel v : AccessChannel.values()){
      if(v.code == code){
        return v;
      }
    }
    return UNKNOWN;
  }
}
